<?PHP

	include("../../includes/configAjax.php");

	if($_SESSION['logged_in']==true){
		$newpw = "";
		$oldpw = "";

		if($_GET['oldpword'] != "" && $_GET['newpword'] != ""){
			$outcome = $users->newPassword($db, $_SESSION['uid'], $_GET['oldpword'], $_GET['newpword']);
			if(!$outcome){
				echo "Incorrect current password supplied. New password not updated.";	
			}
		}
		
		$field['email']=$_GET['email'];
		$field['rname']=$_GET['rname'];
		$field['avatar']=$_GET['avatar'];
		$field['age']=$_GET['age'];
		$field['location']=$_GET['location'];
		$field['occupation']=$_GET['occupation'];
		$field['interests']=$_GET['interests'];

		$field['contact_msn']=$_GET['contact_msn'];
		$field['contact_icq']=$_GET['contact_icq'];
		$field['contact_jabber']=$_GET['contact_jabber'];
		$field['contact_gchat']=$_GET['contact_gchat'];
		$field['contact_yim']=$_GET['contact_yim'];
		$field['contact_website']=$_GET['contact_website'];

		/* signature */
		include("../../includes/forum/post.class.php");
		$post = new post();
		$outcome = $users->updateSignature($db, $post, $_SESSION['uid'], $_GET['signature']);
		if(!$outcome){
			echo "Error updating signature.";	
		}
		
		/* custom fields */
		$outcome = $users->updateCustomFields($db, $_SESSION['uid'], $_GET['custom_links']);
		if(!$outcome){
			echo "Error updating custom fields.";	
		}
		
		/* profile */
		$outcome = $users->updateProfile($db, $_SESSION['uid'], $field);
		if(!$outcome){
			echo "Error updating.";	
		}
		
	} else {
		echo "You are not logged into an account!";	
	}
?>